package com.example.apidocserver.infrastructure.config.input;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;

/**
 * 接口常量配置
 *
 * @author xyqlg
 */
@Configuration
@Slf4j
public class YuqueYmlConfig {
    /**
     * 文档slug或文档id
     */
    public static String SLUG;

    /**
     * 知识库id
     */
    public static String BOOK_ID;

    /**
     * 开关
     */
    public static String SWITCH_CONFIG;

    /**
     * 文档标题
     */
    public static String TITLE;

    /**
     * 团队token
     */
    public static String TOKEN;

    /**
     * 开发apid
     */
    public static String URL;

    @Value("${yuque-config.slug: 1}")
    public void setSlug(String slug) {
        YuqueYmlConfig.SLUG = slug;
    }

    @Value("${yuque-config.book-id: 1}")
    public void setBookId(String bookId) {
        YuqueYmlConfig.BOOK_ID = bookId;
    }

    @Value("${yuque-config.switch-config: false}")
    public void setSwitchConfig(String switchConfig) {
        log.info("config ===== : {}", switchConfig);
        YuqueYmlConfig.SWITCH_CONFIG = switchConfig;
    }

    @Value("${yuque-config.title: 标题}")
    public void setTitle(String title) {
        YuqueYmlConfig.TITLE = title;
    }

    @Value("${yuque-config.token: false}")
    public void setToken(String token) {
        YuqueYmlConfig.TOKEN = token;
    }

    @Value("${yuque-config.url: http://134}")
    public void setUrl(String url) {
        YuqueYmlConfig.URL = url;
    }
}
